package com.neuedu.api;

import java.util.Random;

public class MyMath {
    public static void main(String[] args) {

        //静态属性
        System.out.println("Math.PI = " + Math.PI);
        System.out.println("Math.E = " + Math.E);


        //三角函数
        System.out.println("Math.sin(50) = " + Math.sin(50));


        //开平方
        System.out.println("Math.sqrt(16) = " + Math.sqrt(16));

        //绝对值
        System.out.println("Math.abs(-100) = " + Math.abs(-100));

        System.out.println("Math.round(50.4) = " + Math.round(50.4));
        System.out.println("Math.round(50.5) = " + Math.round(50.5));
        System.out.println("Math.round(50.6) = " + Math.round(50.6));


        //随机数 double类型
        for (int i = 0; i < 5; i++) {
//            System.out.println("Math.random() = " + Math.random());
            System.out.println("Math.random() *100 = " + Math.round(Math.random() * 100));
            //RandomNumberGeneratorHolder.randomNumberGenerator.nextDouble();
        }

        //随机数 伪随机数
        Random randomNumberGenerator = new Random();
        for (int i = 0; i < 5; i++) {
//            System.out.println("randomNumberGenerator.nextInt() = " + randomNumberGenerator.nextInt());
            System.out.println("randomNumberGenerator.nextInt() = " + randomNumberGenerator.nextInt(100));
        }


        //ceil floor
        System.out.println("Math.floor(5.6) = " + Math.floor(5.6)); // 5 4 3 2 1
        System.out.println("Math.ceil(5.6) = " + Math.ceil(5.6)); // 6 7 8 9

        System.out.println("Math.max(10,20) = " + Math.max(10, 20));
        System.out.println("Math.min(10,20) = " + Math.min(10, 20));

//        python    2*3  2**3
        System.out.println("Math.pow(2,3) = " + Math.pow(2, 3));


    }
}
